/*
 * This file is part of shared-drawing.
 * shared-drawing is free software: you can redistribute it and/or modify it 
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option )
 * any later version. shared-drawing is distributed in the hope that it will
 * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
 * Public License for more details.
 * You should have received a copy of the GNU General Public License along with 
 * shared-drawing. If not, see http://www.gnu.org/licenses/.
 */

package shapes;

import primitives.P_Ellipse;
import SharedDrawing.FourCornersShape;
import primitives.P_Line;

public class Actor extends FourCornersShape
{
    private P_Line[] members;
    private P_Ellipse head;
    private int width = 0;
	
    public Actor()
    {
        //create all your primitive and add them to the parent's collection
        members = new P_Line[4];
        head = new P_Ellipse();

        m_composingElements.add(head);

        for(int i = 0; i < 4; i++)
        {
            members[i] = new P_Line();
            m_composingElements.add(members[i]);
        }
    }

    @Override
    public void setShape() 
    {
        //call it if you want to draw corners
        setCorners();
        //set all primitives depending on the location and the size
        //head
        head.setShape(m_location.x + (m_size.x / 3), m_location.y, m_size.x / 3, m_size.y / 3);
        //body
        members[0].setShape(m_location.x + (m_size.x / 2), m_location.y + m_size.y / 3, (m_location.x + (m_size.x / 2) + width), m_location.y + m_size.y - (m_size.y / 3) - width);
        //arms
        members[1].setShape(m_location.x, m_location.y + m_size.y / 2, m_location.x + m_size.x, m_location.y + m_size.y / 2 - width);
        //left leg
        members[2].setShape(m_location.x + m_size.x / 2, m_location.y + m_size.y - (m_size.y / 3) - width, m_location.x, m_location.y + m_size.y);
        //right leg
        members[3].setShape(m_location.x + m_size.x / 2, m_location.y + m_size.y - (m_size.y / 3) - width, m_location.x + m_size.x, m_location.y + m_size.y);

    }
}
